package fr.upmc.mdoc.tp1.servlets;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import fr.upmc.mdoc.tp1.models.Contact;

/**
 * Servlet implementation class EditerContact
 */
public class EditerContact extends HttpServlet {
	private static final long serialVersionUID = 1L;

	/**
	 * @see HttpServlet#HttpServlet()
	 */
	public EditerContact() {
		super();
		// TODO Auto-generated constructor stub
	}

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
	 *      response)
	 */
	protected void doGet(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
	 *      response)
	 */
	protected void doPost(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {

		Contact contact = new Contact();
		contact.setFirstName(request.getParameter("fn"));
		contact.setLastName(request.getParameter("ln"));
		contact.setEmail(request.getParameter("email"));
		contact.getAddress().setStreet(request.getParameter("street"));
		contact.getAddress().setCity(request.getParameter("city"));
		contact.getAddress().setZip(request.getParameter("zip"));
		contact.getAddress().setCountry(request.getParameter("country"));

	}

}
